import 'dart:async';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'common/styles.dart';
import 'config/routeConfig.dart';


class SplashPage extends StatefulWidget {
  @override
  _SplashPageState createState() => _SplashPageState();
}

class _SplashPageState extends State<SplashPage> {

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    const timeout = const Duration(seconds: 1);// 当前时间
    Timer(timeout, () { //callback function
      Get.offNamed(RouteConfig.loginPage);
    });
  }


  @override
  Widget build(BuildContext context) {
    return Container(
      color: Styles.MainBackgroundColor,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Container(
            margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
            child: Image.asset(
              "assets/images/splash.png",
              width: 1.sw,
              height: 1.sh,
              fit: BoxFit.fill,
            ),
          ),
        ],
      ),
    );
  }
}
